package map;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.function.BiConsumer;
import java.util.function.Consumer;

public class ForEachDemo {
    public static void main(String[] args) {
        Map<String,Integer>map = new HashMap<>();
        map.put("语文",60);
        map.put("数学",100);
        map.put("英语",65);
        map.put("物理",99);
        map.put("化学",98);
        System.out.println(map);

        Set<String>keyset = map.keySet();
        keyset.forEach(s -> System.out.println(s));

        Collection<Integer>values = map.values();
        values.forEach(v -> System.out.println(v));

        Set<Map.Entry<String,Integer>>entries = map.entrySet();
        entries.forEach(e -> System.out.println(e.getKey()+","+e.getValue()));

        map.forEach((s , v) -> System.out.println(s+","+v));
    }
}
